<template>
  <div class="operation" :style="{ top: toolbarPosition.top + 'px', left: toolbarPosition.left + 'px' }">
    <!-- 工具栏内容 -->
  </div>
</template>

<script>
export default {
  props: {
    index: Number,
    item: Object,
    addBrotherItem: Function,
    addChildItem: Function,
    testIntem: Function,
    deleteItem: Function,
    expandCollapse: Function,
    formatDateTime: Function
  },
  data() {
    return {
      toolbarPosition: { top: 0, left: 0 }
    };
  },
  mounted() {
    this.calculatePosition();
  },
  methods: {
    calculatePosition() {
      const inputElement = this.$parent.$refs.editInputs[this.index];
      if (inputElement) {
        const rect = inputElement.getBoundingClientRect();
        this.toolbarPosition.top = rect.top - 40; // 根据需要调整偏移量
        this.toolbarPosition.left = rect.left;
      }
    }
  }
}
</script>

<style scoped>
.operation {
  position: absolute;
  z-index: 1000;
}
</style>